File manager - Edit - /home/autoph/public_html/projects/ahg-event/assets/index-f6c0f483.js
Back
import{b as v,L as I,C as M,I as B,B as L,a as V,h as f}from"./Loading-aa057cf2.js";import{s as U,E as T,a as A,u as x,w as N}from"./xlsx-64a1f455.js";import{P as R}from"./Pagination-75845331.js";import{i as F}from"./logo-black-e64f52b7.js";import{_ as Q,k as w,w as y,r as c,o as i,b as u,a as s,t as g,g as h,c as r}from"./index-6d9e3b55.js";const b="https://registration-api.autohub.ph/api/v1/attendance",G={fetchRecords(t={}){return v.get(`${b}`,{params:t})},fetchRecord(t){return v.get(`${b}/${t}`)},async create(t){return v.post(`${b}`,t)},async update(t,e){return v.put(`${b}/${t}`,e)},async remove(t){return v.delete(`${b}/${t}`)}},j={components:{Layout:I,Card:M,Multiselect:U,InputGroup:B,Pagination:R,Button:L,Loading:V},data(){return{imgLogo:F,eventOptions:null,companyOptions:null,state:{isEdit:!1,isLoading:!1,isMounted:!1,isResetError:!1,isSubmitted:!1,showModal:!1,isDeleting:!1},booths:[],items:[],error:[],allItems:[],selectedColumns:["company","mobile","sms_details","time_in"],perPageOptions:[{value:"10",label:"10"},{value:"20",label:"20"},{value:"50",label:"50"},{value:"100",label:"100"}],statusOptions:[{label:"Sent",value:"sent"},{label:"Unsend",value:"unsend"},{label:"Failed",value:"failed"}],searchQuery:null,selectedCompanies:[],selectedSmsStatus:null,currentPage:1,serverOptions:{rowsPerPage:10,sortBy:"lastname",sortType:"asc",event:null},state:{isLoading:!1}}},watch:{serverOptions:{handler(){console.log(`perPage: ${this.serverOptions.rowsPerPage}`),this.fetchAll(),this.fetchCompanies()},deep:!0}},computed:{isAdmin:function(){return(localStorage.getItem("activeUser")?JSON.parse(localStorage.getItem("activeUser")):null).isAdmin},filteredItems:function(){let t=[];return this.allItems.length>0&&(t=this.allItems,this.searchQuery&&(t=t.filter(e=>e.fullname.toLowerCase().includes(this.searchQuery.toLowerCase()))),this.selectedCompanies.length>0&&(t=t.filter(e=>this.selectedCompanies.includes(e.participant.company_id))),this.selectedSmsStatus&&(t=t.filter(e=>e.sms_status==this.selectedSmsStatus))),t},perPage:function(){return this.serverOptions.rowsPerPage},filteredEventOptions:function(){return this.eventOptions?this.eventOptions.filter(t=>[30,31,32,33,34,35].includes(t.value)):[]},columns:function(){let t=[];return t.push({label:"Name",field:"fullname",tdClass:""}),this.selectedColumns.includes("company")&&t.push({label:"Company",field:"company",sortable:!1}),this.selectedColumns.includes("mobile")&&this.isAdmin&&t.push({label:"Mobile",field:"mobile",sortable:!1}),this.selectedColumns.includes("sms_details")&&t.push({label:"SMS Status",field:"sms_details",sortable:!1}),this.selectedColumns.includes("time_in")&&t.push({label:"Time In",field:"attendance"}),this.booths.length>0&&this.isAdmin&&this.booths.forEach(e=>{this.selectedColumns.includes("booth_"+e.id)&&t.push({label:e.name,field:"booth_"+e.id})}),t},columnOptions:function(){let t=[{label:"Company",value:"company"},{label:"SMS Status",value:"sms_details"},{label:"Time In",value:"time_in"}];return this.isAdmin&&(t.push({label:"Mobile",value:"mobile"}),this.booths.length>0&&this.booths.forEach(e=>{t.push({label:e.name,value:"booth_"+e.id})})),t},totalSent(){return this.allItems.reduce((e,l)=>l.sms_status=="sent"?e+1:e+0,0)},totalUnsend(){return this.allItems.reduce((e,l)=>l.sms_status=="unsend"?e+1:e+0,0)},totalFailed(){return this.allItems.reduce((e,l)=>l.sms_status=="failed"?e+1:e+0,0)},totalItems(){return this.filteredItems.length}},methods:{formatDate(t,e=null){return f(t).format(e??"YYYY-MM-DD hh:mma")},async fetchEvents(){await T.fetchRecords().then(t=>{console.log("response"),console.log(t),t.status==200?(this.eventOptions=t.data.data.map(e=>({label:e.name,value:e.id,booths:e.booths,date:f(e.date).format("YYYY-MM-DD")})),this.serverOptions.event==null&&(this.serverOptions.event=t.data.data.filter(e=>f(e.date).format("YYYY-MM-DD")==f(new Date).format("YYYY-MM-DD")).map(e=>e.id).toString()),console.log(this.events)):console.log(t)}).catch(t=>{console.error(t)})},fetchBooths(){let t=this.eventOptions.find(e=>e.value==this.serverOptions.event);t&&(this.booths=t?t.booths:null,this.booths.forEach(e=>{this.selectedColumns.includes(`booth_${e.id}`)||this.selectedColumns.push(`booth_${e.id}`)}),console.log("this.booths"),console.log(this.booths))},async fetchAll(){this.state.isLoading=!0,await G.fetchRecords({event_id:this.serverOptions.event,companies:this.selectedCompanies,keyword:this.searchQuery,sortBy:this.serverOptions.sortBy,sortType:this.serverOptions.sortType}).then(t=>{t.status==200&&(this.allItems=t.data.data.map((e,l)=>({count:l+1,...e,fullname:e.participant?`${e.participant.lastname}, ${e.participant.firstname} ${e.participant.middlename??""}`:null,company:e.participant.company?e.participant.company.name:null,mobile:e.participant.mobile?e.participant.mobile:null,sms_status:e.sms_status??null,sms_details:e.sms_details??null,attendance:e.attendance?f(e.attendance).format("YYYY-MM-DD h:mma"):null,booth_visit:e.booth_visit})),this.allItems.forEach(e=>{e.booth_visit&&e.booth_visit.length>0&&e.booth_visit.forEach(l=>{e["booth_"+l.id]=f(l.pivot.created_at).format("YYYY-MM-DD h:mma")})}),console.log("this.allItems"),console.log(this.allItems),this.fetchBooths())}).finally(()=>{this.state.isLoading=!1})},async fetchCompanies(){await A.fetchCompanies(this.serverOptions.event).then(t=>{if(t.status==200){console.log(this.companyOptions);let e=t.data.filter(d=>d!==null),l=[];e.forEach(d=>{l[d.id]=d.name}),this.companyOptions=l.map((d,n)=>({label:d,value:n}))}})},handlePageChange(t){console.log(t),console.log(this.currentPage),this.currentPage!=t&&(this.currentPage=t)},handlePerPageChange(t){this.serverOptions.rowsPerPage=t},onSortChange(t){console.log(t),t[0].type!="none"&&(this.serverOptions.sortBy=t[0].field,this.serverOptions.sortType=t[0].type)},confirmExport(){this.$swal.fire({title:"Are you sure you want to download these records?",text:"",icon:"question",showCancelButton:!0,confirmButtonColor:"#34c38f",cancelButtonColor:"#f46a6a",confirmButtonText:"Yes",cancelButtonText:"No"}).then(t=>{t.value&&this.exportToExcel()})},exportToExcel(){let t=this.filteredItems,e=this.columns;const l=this.eventOptions.filter(p=>p.value==this.serverOptions.event).flatMap(p=>p.label).toString();console.log(l);const d=[e.map(p=>p.label)];t.forEach(p=>{const m=[];e.forEach(_=>{_.field=="sms_details"&&(_.field="sms_status"),m.push(p[_.field])}),d.push(m)});const n=x.aoa_to_sheet(d),a=x.book_new();x.book_append_sheet(a,n,"Sheet1"),N(a,`${l}-attendance.xlsx`)}},created(){this.fetchEvents(),this.fetchAll(),this.fetchCompanies()}},q={class:"w-full flex justify-between mb-2"},J={class:"flex gap-2 align-items-bottom"},X=s("div",{class:"font-semibold"},"SMS Summary:",-1),z=s("span",null,"Sent: ",-1),H={class:"bg-green-500 py-1 px-2 rounded-md text-white"},K=s("span",null,"Unsend: ",-1),W={class:"bg-slate-300 py-1 px-2 rounded-md"},Z=s("span",null,"Failed: ",-1),$={class:"bg-red-500 py-1 px-2 rounded-md text-white"},ee={class:"grid gap-1 mb-2"},te={class:"grid lg:grid-cols-2 gap-3"},se={key:0,class:"flex gap-0 w-full border border-green-500 rounded"},oe=s("div",{class:"bg-green-500 text-white px-3 py-2 mr-[-2px]"},"Event",-1),ne={class:"grid lg:grid-cols-2 gap-3"},le={class:"flex gap-0 w-full border border-green-500 rounded"},ae=s("div",{class:"bg-green-500 text-white px-3 py-2 mr-[-2px] w-[150px]"},"SMS Status",-1),ie={class:"grid lg:grid-cols-2 gap-3"},re={key:0,class:"flex gap-0 w-full border border-green-500 rounded"},de=s("div",{class:"bg-green-500 text-white px-3 py-2 mr-[-2px]"},"Company",-1),ce={key:1,class:"flex gap-0 w-full border border-green-500 rounded"},ue=s("div",{class:"bg-green-500 text-white px-3 py-2 mr-[-2px]"},"Columns",-1),he={key:0,class:"grid"},pe={key:0,class:"bg-green-500 p-1 rounded-md text-white text-center text-sm w-[50px]"},me={key:1,class:"bg-slate-200 p-1 rounded-md text-sm w-[120px] text-center"},fe={key:2,class:"bg-red-500 p-1 rounded-md text-sm w-[60px] text-white text-center"},ge={key:3,class:"text-slate-500 text-sm"},_e=s("span",{class:"text-blue-500 font-semibold"},"Attempts: ",-1),ve={key:4,class:"text-slate-500 text-sm"},be=s("span",{class:"text-indigo-700"},"Date Last Sent: ",-1),ye={key:5,class:"text-sm"},xe=s("span",null,"Reason: ",-1),we={class:"text-red-500"},Ce={key:1,class:"flex gap-1"},Se={class:"py-4 px-3"};function Oe(t,e,l,d,n,a){const p=c("Button"),m=c("Multiselect"),_=c("InputGroup"),S=c("Loading"),O=c("EditButton"),P=c("DeleteButton"),E=c("Pagination"),Y=c("vue-good-table"),k=c("Card"),D=c("Layout");return i(),w(D,null,{default:y(()=>[u(k,null,{default:y(()=>[s("div",q,[s("div",J,[X,s("div",null,[z,s("span",H,g(a.totalSent),1)]),s("div",null,[K,s("span",W,g(a.totalUnsend),1)]),s("div",null,[Z,s("span",$,g(a.totalFailed),1)])]),a.totalItems>0?(i(),w(p,{key:0,type:"button",class:"p-2 px-4 rounded border-green-500 bg-green-500 text-white float-end",onClick:a.confirmExport,icon:"ri:file-excel-2-line",text:"Download",title:"Export to XLS"},null,8,["onClick"])):h("",!0)]),s("header",ee,[s("div",te,[a.filteredEventOptions?(i(),r("div",se,[oe,u(m,{modelValue:n.serverOptions.event,"onUpdate:modelValue":e[0]||(e[0]=o=>n.serverOptions.event=o),options:a.filteredEventOptions,searchable:!0},null,8,["modelValue","options"])])):h("",!0),s("div",ne,[s("div",null,[u(_,{modelValue:n.searchQuery,"onUpdate:modelValue":e[1]||(e[1]=o=>n.searchQuery=o),class:"w-full border border-green-500 focus:border-green-500 rounded",placeholder:"Search",type:"text",prependIcon:"heroicons-outline:search",merged:""},null,8,["modelValue"])]),s("div",null,[s("div",le,[ae,u(m,{modelValue:n.selectedSmsStatus,"onUpdate:modelValue":e[2]||(e[2]=o=>n.selectedSmsStatus=o),options:n.statusOptions,searchable:!0},null,8,["modelValue","options"])])])])]),s("div",ie,[n.companyOptions?(i(),r("div",re,[de,u(m,{modelValue:n.selectedCompanies,"onUpdate:modelValue":e[3]||(e[3]=o=>n.selectedCompanies=o),options:n.companyOptions,searchable:!0,mode:"tags",closeOnSelect:!1},null,8,["modelValue","options"])])):h("",!0),a.columnOptions?(i(),r("div",ce,[ue,u(m,{modelValue:n.selectedColumns,"onUpdate:modelValue":e[4]||(e[4]=o=>n.selectedColumns=o),options:a.columnOptions,searchable:!0,mode:"tags",closeOnSelect:!1},null,8,["modelValue","options"])])):h("",!0)])]),s("section",null,[n.state.isLoading?(i(),w(S,{key:0,searching:!0,text:"Fetching records"})):h("",!0),u(Y,{columns:a.columns,styleClass:"vgt-table bordered table-head lesspadding v-middle",rows:a.filteredItems,search:!0,"sort-options":{enabled:!0,initialSortBy:{field:"fullname",type:"asc"}},"pagination-options":{enabled:!0,perPage:n.serverOptions.rowsPerPage},onSortChange:a.onSortChange,"max-height":"600px"},{"table-row":y(o=>[o.column.field=="sms_details"?(i(),r("div",he,[o.row.sms_details.status?(i(),r("div",pe,"SENT")):o.row.sms_details.attempts==0?(i(),r("span",me,"NOT YET SEND")):(i(),r("span",fe,"FAILED")),o.row.sms_details.attempts>0?(i(),r("div",ge,[_e,s("span",null,g(o.row.sms_details.attempts),1)])):h("",!0),o.row.sms_details.date_last_sent?(i(),r("div",ve,[be,s("span",null,g(a.formatDate(o.row.sms_details.date_last_sent,"YYYY-MM-DD hh:mm a")),1)])):h("",!0),o.row.sms_details.error_message?(i(),r("div",ye,[xe,s("span",we,g(o.row.sms_details.error_message.desc),1)])):h("",!0)])):h("",!0),o.column.field=="action"?(i(),r("div",Ce,[u(O,{link:{name:"edit-unit-of-measure",params:{id:o.row.id}}},null,8,["link"]),u(P,{onClick:C=>t.deleteRecord(o.row.id)},null,8,["onClick"])])):h("",!0)]),"pagination-bottom":y(o=>[s("div",Se,[u(E,{enableSelect:"",total:a.totalItems,current:n.currentPage,"per-page":n.serverOptions.rowsPerPage,pageRange:t.pageRange,onPageChanged:e[5]||(e[5]=C=>n.currentPage=C),pageChanged:o.pageChanged,perPageChanged:o.perPageChanged,options:n.perPageOptions},null,8,["total","current","per-page","pageRange","pageChanged","perPageChanged","options"])])]),_:1},8,["columns","rows","pagination-options","onSortChange"])])]),_:1})]),_:1})}const Ie=Q(j,[["render",Oe]]);export{Ie as default};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings